from django.core.management.base import BaseCommand
from django.core.management import call_command


class Command(BaseCommand):
    help = 'Load initial data fixtures in the correct order'

    def handle(self, *args, **options):
        fixture_files = [
            'initial_specializations_fixture.json',
            'initial_specialization_type_fixture.json',
            'initial_groups_fixture.json',
            'initial_users_fixture.json',
        ]

        for fixture_file in fixture_files:
            self.stdout.write(f'Loading {fixture_file}')
            call_command('loaddata', fixture_file)
            self.stdout.write(self.style.SUCCESS(f'Successfully loaded {fixture_file}'))
